@extends("agent.layouts.main")
<style>
    .my-ver-align {
        vertical-align: -2px;
    }

    .btn-link {
        color: gray;
    }

    .my-daili {
        top: 50%;
        right: 0;
        z-index: 1;
        margin-top: -13.6px;
    }
</style>
@section("content")
<div class="container-fiuld p-3">
    <div class="card">
        <div class="card-body pt-1">
            <div class="row mt-1 mb-2">
                <div class="col-lg-12 pt-3 pb-3" style="background-color:#F2F2F2">
                    <form class="form-inline position-relative">
                        <label for="stime">时间：</label>
                        <input type="text" name="stime" class="layui-input test-laydate-item form-control mr-3"
                               style="border-color:#ced4da" id="stime" value="{{$stime}}" placeholder="开始时间"
                               lay-key="1">
                        <input type="text" name="etime" class="layui-input test-laydate-item form-control mr-3"
                               style="border-color:#ced4da" id="etime" value="{{$etime}}" placeholder="结束时间"
                               lay-key="2">
                        <select class="form-control" name="status" id="status">
                            <option value="">全部</option>
                            <option value="3" @if($status== 3) selected @endif>审核中</option>
                            <option value="1" @if($status== 1) selected @endif>提现成功</option>
                            <option value="2" @if($status== 2) selected @endif>提现失败</option>
                        </select>
                        <a class="btn btn-primary btn-sm ml-5 mr-3 search text-white">查询</a>
                        <button type="reset" class="btn btn-secondary mr-3 btn-sm">重置</button>
                    </form>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12 table-responsive">
                    <table class="table layui-form">
                        <thead class="thead-light">
                        <tr class="text-dark">
                            <th>ID</th>
                            <th>姓名</th>
                            <th>支付宝</th>
                            <th>佣金</th>
                            <th>第三方订单号</th>
                            <th>状态</th>
                            <th>创建时间</th>
                            <th>审核时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($draw as $v)
                        <tr>
                            <td>{{ $v->id }}</td>
                            <td>{{ $v->drawaccount ? $v->drawaccount->name : '' }}</td>
                            <td>{{ $v->drawaccount ? $v->drawaccount->alipay : '' }}</td>
                            <td>{{ $v->money}}</td>
                            <td>{{ $v->order_id}}</td>
                            <td>
                                @if($v->status == 1)
                                <span class="layui-badge layui-bg-blue">提现成功</span>
                                @elseif($v->status == 2)
                                <span class="layui-badge">提现失败</span>
                                @else
                                <span class="layui-badge layui-bg-gray">审核中</span>
                                @endif
                            <td>{{ $v->created_at}}</td>
                            <td>{{ $v->updated_at ? $v->updated_at : '-'}}</td>
                        </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div style="text-align: right;">
            {{ $draw->appends(['stime'=>$stime, 'etime' => $etime, 'status' => $status])->links('agent.layouts.paginate') }}
        </div>
    </div>
</div>
@endsection

@section("js")
<script type="text/javascript">
    layui.use(['form', 'ori', "laydate"], function () {
        var form = layui.form,
            ori = layui.ori,
            dialog = layui.dialog,
            $ = layui.$
        laydate = layui.laydate;
        var stime = '';
        var etime = '';
        lay('.test-laydate-item').each(function () {
            laydate.render({
                elem: this
                , trigger: 'click'
            });
        });
        $('.search').click(function () {
            var stime = $("#stime").val();
            var etime = $("#etime").val();
            var status = $("#status").val();
            location.href = "{{ route('withdraw') }}" + '?stime=' + stime + ' &etime=' + etime + '&status=' + status;
        });
		ori.reset("[type=reset]");
    });
</script>
@endsection
